<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output indent="yes" xml:space="default" method="xml"/>
    <xsl:template match="/">
        <response>
            <xsl:attribute name="message"><xsl:value-of select="//message/text/text()"/></xsl:attribute>
            <xsl:attribute name="code"><xsl:value-of select="//message/code/text()"/></xsl:attribute>
            <xsl:apply-templates select="//results"/>
        </response>
    </xsl:template>
    <xsl:template match="result">
        <xsl:element name="result">
            <xsl:attribute name="yearbuilt">
                <xsl:value-of select="yearBuilt/text()"/>
            </xsl:attribute>
            <xsl:attribute name="finishedSqFt">
                <xsl:value-of select="finishedSqFt/text()"/>
            </xsl:attribute>
            <xsl:attribute name="bedrooms">
                <xsl:value-of select="bedrooms/text()"/>
            </xsl:attribute>
            <xsl:attribute name="bathrooms">
                <xsl:value-of select="bathrooms/text()"/>
            </xsl:attribute>
            <xsl:attribute name="lastSoldDate">
                <xsl:value-of select="lastSoldDate/text()"/>
            </xsl:attribute>
            <xsl:attribute name="lastSoldPrice">
                <xsl:value-of select="lastSoldPrice/text()"/>
            </xsl:attribute>
            <xsl:attribute name="valuation">
                <xsl:value-of select="zestimate/amount/text()"/>
            </xsl:attribute>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>